prune: Don't fail if a to-be-pruned object doesn't exist
authorColin Walters <walters@verbum.org>
Tue, 16 Jul 2013 14:01:58 +0000 (10:01 -0400)
committerColin Walters <walters@verbum.org>
Tue, 16 Jul 2013 14:01:58 +0000 (10:01 -0400)
Previously, if a prune was interrupted, further attempts would fail.
It's just better to silently continue here.

src/libostree/ostree-repo-prune.c

index 0f173d504fb3d230c6b38da9349e77b1d4367180..5260e33fce731063a2ab5fec0e8f394edd2447db 100644 (file)
@@ -56,15 +56,17 @@ maybe_prune_loose_object (OtPruneData        *data,
         {
           gs_unref_object GFileInfo *info = NULL;
 
-          if ((info = g_file_query_info (objf, OSTREE_GIO_FAST_QUERYINFO,
-                                         G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
-                                         cancellable, error)) == NULL)
+          if (!ot_gfile_query_info_allow_noent (objf, OSTREE_GIO_FAST_QUERYINFO,
+                                                G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                                &info, cancellable, error))
             goto out;
 
-          if (!gs_file_unlink (objf, cancellable, error))
-            goto out;
-
-          data->freed_bytes += g_file_info_get_size (info);
+          if (info)
+            {
+              if (!gs_file_unlink (objf, cancellable, error))
+                goto out;
+              data->freed_bytes += g_file_info_get_size (info);
+            }
         }
       if (OSTREE_OBJECT_TYPE_IS_META (objtype))
         data->n_unreachable_meta++;